<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
/**
 * TAYGOD Company Manage System
 *
 * 基于Codeigniter的企业网站管理系统
 * 
 * TAYGOD is an open source multi-privilege Company Manage System built on the 
 * well-known PHP framework Codeigniter.
 *
 * @package		TAYGOD
 * @author		T.l <madma@163.com>
 * @copyright	Copyright (c) 2012 , taygod.com.
 * @license		GNU General Public License 2.0
 * @link		http://taygod.com/
 * @version		1.0.0
 */
 
// ------------------------------------------------------------------------

/**
 * TAYGOD Category Class
 *
 * 网站配置操作Model
 *
 * @package		TAYGOD
 * @subpackage	Models
 * @category	Models
 * @author		T.l <madma@163.com>
 * @link		http://taygod.com/
 */

class Model_setting extends Lin_Model {
	
	function __construct(){
		parent::__construct();
		// Load the associated table
        $this->load_table('setting');
	}
	 
	

	/**
	 * 
	 * 获取网站配置数组
	 * @return array
	 */
	function get_settings(){
		
		$settings = $this->find_all();
		
		foreach ($settings as  $value) {
			
			$arr[$value['skey']] = $value['svalue'];
			 
		}
		
		$arr['theme_dir'] = $this->_get_theme_dir();
		
		return $arr;
		
	}
	
	//返回模板名称
	function _get_theme_dir(){
		
		
		$this->load->helper('directory');
		$dir = FCPATH."template/"; 
		$map = directory_map($dir,1);
		
		$nums = count($map); 
		
		for ($i=0;$i<$nums;$i++){ 
			 if(!is_dir($dir.$map[$i]))
			 {
			 	unset($map[$i]);
			 }
			 else
			 {
			 	$arr[] = $map[$i];
			 }
			 
		}
		return $arr;
	}
	
	
	
	
	
	
	
	
	
	
	

}  //end class




/* End of file model_news.php */
/* Location: ./core/app/models/model_news.php */
